﻿using System;
using System.ComponentModel;

namespace NTTDATA.BEENChina.ResultCertification.PropertyGridUtil
{
    internal class CustomConverter : ExpandableObjectConverter
    {
        public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
        {
            if (destType == typeof(string) && value is PropertyData)
            {
                // Cast the value to an Employee type
                PropertyData data = (PropertyData)value;

                // Return department and department role separated by comma.
                //return pair.Key + ", " + pair.Value;
                return data.GetValue();
            }
            return base.ConvertTo(context, culture, value, destType);
        }
    }
}
